<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<table id="table"></table>
		<script type="text/javascript">
			let table=document.getElementById("table");
			let books=[];
			books[1]={id: 1 , name:'haha'};
			books.push({id: 2,name:'hehe'});
			console.log(books);
			let thead = document.createElement("thead");
			let th=document.createElement("th");
			thead.appendChild(th);
			
			let td=document.createElement("td");
			td.innerHTML="ID";
			th.appendChild(td);
			
			td=document.createElement("td");
			td.innerHTML="书籍名称";
			th.appendChild(td);
			
			td=document.createElement("td");
			td.innerHTML="日期";
			th.appendChild(td);
			
			td=document.createElement("td");
			td.innerHTML="价格";
			th.appendChild(td);
			
			td=document.createElement("td");
			td.innerHTML="购买数量";
			th.appendChild(td);
			
			td=document.createElement("td");
			td.innerHTML="操作";
			th.appendChild(td);
			
			table.appendChild(thead);
			
			
			
			/*for循环，for循环里面是父级作用域，循环体内是另一个*/
			
			for( var i = 0 ; i < 3 ; i++ ){
			    var i = 'abc'　　　　//用var替代let会报错提示已经定义，若没有任何关键字则每次赋值给i，最后只会输出一次abc
			    console.log(i) 　　 // 输出3次abc  
			  }
			

		</script>
	</body>
</html>
